var windowNameIndex = parent.layer.getFrameIndex(window.name); //获取窗口索引
$("#ensure").click(function () {
    var ytreatmentUnitl = $("#ytreatmentUnitl").val();     //原科室
    var xtreatmentUnitl = $("#xtreatmentUnitl").val();     //新科室
    var customerId = $("#customerId").val();             //备注
    var remarks = $("#remarks").val();             //备注
    var reservationsId = $("#reservationsId").val();
    var id = $("#idValue").val();
    $.ajax({
        url: Feng.ctxPath + "/customer/updateTreatmentUnit2",
        type: "post",
        data: {
            reservationsId: reservationsId,
            id: id,
            ytreatmentUnitl: ytreatmentUnitl,
            xtreatmentUnitl: xtreatmentUnitl,
            customerId: customerId,
            remarks: remarks,
            isno: "同意"
        },
        success: function (data) {
            Feng.success('操作成功!');
            window.parent.updateTreatmentUnitl.table.refresh();
            parent.layer.close(windowNameIndex);
        },
        error: function (data) {
            alert('没有权限，请联系系统管理员!');
            $("#cancel").click();
        }
    });
});

$("#noEnsure").click(function () {
    var ytreatmentUnitl = $("#ytreatmentUnitl").val();     //原科室
    var xtreatmentUnitl = $("#xtreatmentUnitl").val();     //新科室
    var customerId = $("#customerId").val();             //备注
    var remarks = $("#remarks").val();             //备注
    var reservationsId = $("#reservationsId").val();
    var id = $("#idValue").val();
    $.ajax({
        url: Feng.ctxPath + "/customer/updateTreatmentUnit2",
        type: "post",
        data: {
            reservationsId: reservationsId,
            id: id,
            ytreatmentUnitl: ytreatmentUnitl,
            xtreatmentUnitl: xtreatmentUnitl,
            customerId: customerId,
            remarks: remarks,
            isno: "不同意"
        },
        success: function (data) {
            Feng.success('操作成功!');
            window.parent.updateTreatmentUnitl.table.refresh();
            parent.layer.close(windowNameIndex);
        },
        error: function (data) {
            alert('没有权限，请联系系统管理员!');
            parent.layer.close(windowNameIndex);
        }
    });
});

$("#cancel").click(function () {
    parent.layer.close(windowNameIndex);
});